{if $content_data.CATEGORIES_DATA|@count > 0} {block name="category_subcategories"}

{foreach name=cat_data item=categories_item from=$content_data.CATEGORIES_DATA} {if $categories_item.children|@count > 0}{assign var="children_found" value="true"}{/if} {/foreach} {if $children_found} {block name="category_subcategories_children_found"} {counter start=0 assign="cnt"} {foreach name=cat_data item=categories_item from=$content_data.CATEGORIES_DATA} {block name="category_subcategories_children_found_item"}
- {$categories_item.data.name} {if $categories_item.children|@count > 0} {block name="category_subcategories_children_found_sublist"}
  {foreach item=children_item from=$categories_item.children} {block name="category_subcategories_children_found_subitem"}
  - {$children_item.data.name}
  {/block} {/foreach}
  {/block} {/if}
{/block} {if $cnt eq 4}

{counter start=0 assign="cnt"}{/if} {/foreach} {/block} {else} {block name="category_subcategories_no_children"}
- {foreach name=cat_data item=categories_item from=$content_data.CATEGORIES_DATA} {block name="category_subcategories_no_children_item"}
  - {$categories_item.data.name}
  {/block} {/foreach}
{/block} {/if}

{/block} {/if}